package com.czh.service.Bill;
import com.czh.dao.BaseDao;
import com.czh.dao.Bill.BillDao;
import com.czh.dao.Bill.BillDaoImpl;
import com.czh.pojo.Bill;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class BillServiceImpl implements BillService {
    private BillDao billDao = null;
    public BillServiceImpl() {
        billDao = new BillDaoImpl();
    }

    @Override
    public List<Bill> BillList(String productName, int providerId, int isPayment) {
        List<Bill> billList;
        try {
            Connection connection = BaseDao.getConnection();
             billList= billDao.BillList(connection, productName, providerId, isPayment);
             BaseDao.closeConnect(connection,null,null);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return billList;
    }
}
